package org.richfaces.beans;

import java.io.Serializable;

import javax.faces.bean.ManagedBean;
import javax.faces.bean.RequestScoped;

import org.hibernate.test.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;


@ManagedBean(name="passwordChange")
@Controller
@RequestScoped
public class PasswordChange implements  Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private String password;
	private String confirm;
	
	@Autowired
	private UserService userService;

	public void setPassword(String password) {
		this.password = password;
	}

	public String getPassword() {
		return password;
	}

	public void setConfirm(String reTypePassword) {
		this.confirm = reTypePassword;
	}

	public String getConfirm() {
		return confirm;
	}

	public boolean savePassword() {
		System.err.println(" ****************  Salvando ****************");
		
		return userService.changeUserPassword(this.password);
		//return password.equals(confirm);
		
	}
	
	
}
